{% extends 'datacenter/base/center_base.html' %}
{% load post_filters %}

{% block head %}
    <script src="{% static 'js/caoliu_manage.min.js' %}"></script>
    <meta name="referrer" content="none">
{% endblock %}

{% block title %}
    Post Management
{% endblock %}

{% block main %}
    <section class="content">
        <div class="container-fluid pt-4">
            <div class="row">
                <div class="col-sm-12">
                    <div class="card">

                        <div class="card-header">
                            <div class="p-2 d-flex">
                                <p class="h3">Avgle</p>
                                <form action="" method="get" class="form-inline ml-auto">
                                    <input type="text" value="{{ cur_fid }}" name="fid" hidden>
                                    <div class="form-group mr-4">
                                        <label for="">时间：</label>
                                        {% if select_time %}
                                            <input type="text" class="form-control" name="day" id="start-picker"
                                                   readonly value="{{ select_time }}">
                                        {% else %}
                                            <input type="text" class="form-control" name="day" id="start-picker"
                                                   readonly>
                                        {% endif %}
                                    </div>
                                    <div class="form-group mr-4">
                                        <label for="title-input">标题：</label>
                                        {% if title %}
                                            <input type="text" class="form-control" name="search" id="title-input"
                                                   placeholder="关键字"
                                                   value="{{ title }}">
                                        {% else %}
                                            <input type="text" class="form-control" name="search" id="title-input"
                                                   placeholder="关键字">
                                        {% endif %}
                                    </div>
                                    <div class="form-group mr-4">
                                        <button class="btn btn-primary">查询</button>
                                    </div>
                                    <div class="form-group">
                                        <a href="?fid={{ curblock }}">清除查询</a>
                                    </div>
                                </form>
                            </div>
                        </div>

                        <div class="card-body">
                            <div class="row">
                                {% for item in list_data %}
                                    <div class="row col-sm-3 pl-1 pr-1 mb-4">
                                        <div class="row col-sm-12">
                                            <small>{{ item.jp_title }}</small>
                                        </div>
                                        <div class="row col-sm-12">
                                            <a href="{{ item.jp_url }}">{{ item.jp_location }}</a>
                                        </div>
                                        <div class="row col-sm-12">
                                            <small>{{ item.jp_level }}</small>
                                        </div>
                                        <div class="row col-sm-12">
                                            <small>{{ item.jp_max_level }}</small>
                                        </div>
                                    </div>
                                {% endfor %}
                            </div>

                            <div class="row">
                                <div class="col-sm-5">
                                    <p class="pull-left">第{{ current_page }}页/总共{{ num_pages }}页</p>
                                </div>
                                <div class="col-sm-7">
                                    <div class="dataTables_paginate paging_simple_numbers float-right">
                                        <ul class="pagination">
                                            {#上一页#}
                                            {% if page_obj.has_previous %}
                                                <li class="paginate_button page-item "><a class="page-link" href="?p={{ page_obj.previous_page_number }}{{ url_query }}">上一页</a></li>
                                            {% else %}
                                                <li class="paginate_button page-item previous disabled"><a
                                                        class="page-link"
                                                        href="javascript:void(0);">上一页</a>
                                                </li>
                                            {% endif %}

                                            {# 是否需要出现三个点 #}
                                            {% if left_has_more %}
                                                <li class="paginate_button page-item "><a class="page-link" href="?p=1">1</a>
                                                </li>
                                                <li class="paginate_button page-item "><a class="page-link"
                                                                                          href="javascript:void(0);">...</a>
                                                </li>
                                            {% endif %}

                                            {# 左边的页码 #}
                                            {% for left_page in left_pages %}
                                                <li class="paginate_button page-item "><a class="page-link" href="?p={{ left_page }}{{ url_query }}">{{ left_page }}</a></li>
                                            {% endfor %}

                                            {# 当前的页面 #}
                                            <li class="paginate_button page-item  active"><a class="page-link" href="?p={{ current_page }}{{ url_query }}">{{ current_page }}</a></li>

                                            {# 右边的页码 #}
                                            {% for right_page in right_pages %}
                                                <li class="paginate_button page-item "><a class="page-link" href="?p={{ right_page }}{{ url_query }}">{{ right_page }}</a></li>
                                            {% endfor %}

                                            {# 用来控制右边三个点 #}
                                            {% if right_has_more %}
                                                <li class="paginate_button page-item "><a class="page-link"
                                                                                          href="javascript:void(0);">...</a>
                                                </li>
                                                <li class="paginate_button page-item "><a class="page-link" href="?p={{ num_pages }}{{ url_query }}">{{ num_pages }}</a></li>
                                            {% endif %}

                                            {#下一页#}
                                            {% if page_obj.has_next %}
                                                <li class="paginate_button page-item next"><a class="page-link" href="?p={{ page_obj.next_page_number }}{{ url_query }}">下一页</a>
                                                </li>
                                            {% else %}
                                                <li class="paginate_button page-item next disabled"><a class="page-link"
                                                                                                       href="javascript:void(0);">下一页</a>
                                                </li>
                                            {% endif %}
                                        </ul>
                                    </div>

                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>



{% endblock %}
